import { parseText } from '../../../../../utils/message-parse';
// eslint-disable-next-line no-undef
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    message: {
      type: Object,
      value: {},
      observer(newVal) {
        let list = parseText(newVal)
        list.forEach(item=>{
          if(item.text && item.text.indexOf('/packageA/detail_v2/detail_v2') !== -1){
            item.isLink = true;
          }
        })
        this.setData({
          renderDom: list,
        });
      },
    },
    isMine: {
      type: Boolean,
      value: true,
    },
  },

  /**
   * 组件的初始数据
   */
  data: {

  },
  ready(){
    console.log(this.data.message)
  },
  lifetimes: {
    attached() {
      // 在组件实例进入页面节点树时执行
    },
    detached() {
      // 在组件实例被从页面节点树移除时执行
    },
  },
  /**
   * 组件的方法列表
   */
  methods: {
    isGoodsUrl(){
      
    },
    openLink(e){
      let url = e.currentTarget.dataset.text;
      if(url.indexOf('/packageA/detail_v2/detail_v2') !== -1){
        //url += '?fromTravelShop=1&id=362';
        wx.navigateTo({
          url
        })
      }
      console.log(e)
    }
  },
});
